<?php
/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
include( "../global/initialize.php");

aos_header( 'Expeditions' );

$query = "SELECT * " .
		"FROM expeditions " .
		"ORDER BY required_level ASC, gold_cost ASC";
$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
$num = mysql_numrows( $result );
?>
					<table>
    					<tr><th colspan="10"><?php transprint( 'Expeditions list' ); ?></th></tr>
    					<tr>
    						<td><?php transprint( 'Name' ); ?></td>
    						<td align="right"><?php transprint( 'Gold' ); ?></td>
    						<td align="right"><?php transprint( 'Iron' ); ?></td>
    						<td align="right"><?php transprint( 'Coal' ); ?></td>
    						<td align="right"><?php transprint( 'Recruits' ); ?></td>
    						<td align="right"><?php transprint( 'Time' ); ?></td>
    						<td align="right"><a href="../upgrade/upgradeinfo.php?id=31"><?php transprint( 'Navigation level' ); ?></a></td>
    					</tr>
<?php
$i = 0;
while ( $i < $num ) {
    if( $i % 2 == 0 ) {
        print( "<tr class=\"even\">\r\n" );
    }
    else {
        print( "<tr>\r\n" );
    }
    
    print( "<td><a href=\"../operations/expedition.php?id=" . mysql_result( $result, $i, "expedition_id" ) . "\">" . translate( mysql_result( $result, $i, "name" ) ) . "</a></td>\r\n" );
    print( "<td align=\"right\"><strong class=\"gold\">" . number_format( mysql_result( $result, $i, "gold_cost" ) ) . "</strong></td>\r\n" );
    print( "<td align=\"right\"><strong class=\"iron\">" . number_format( mysql_result( $result, $i, "iron_cost" ) ) . "</strong></td>\r\n" );
    print( "<td align=\"right\"><strong class=\"coal\">" . number_format( mysql_result( $result, $i, "coal_cost" ) ) . "</strong></td>\r\n" );
    print( "<td align=\"right\">" . number_format( mysql_result( $result, $i, "recruit_cost" ) ) . "</td>\r\n" );
    $time = mysql_result( $result, $i, "time_cost" );
    if( $time == 1 ) {
    	$time = "1 " . translate( "day" );
    }
    else {
    	$time = number_format( $time ) . ' ' . translate( 'days' );
    }
    print( "<td align=\"right\">$time</td>\r\n" );
    print( "<td align=\"right\">" . mysql_result( $result, $i, "required_level" ) . "</td>\r\n</tr>\r\n" );
    $i ++;
}
?>
					</table>
<?php
aos_footer();
?>
